<template>
<!-- 负责路由跳转 -->
  <div class="xtx-bread-item">
    <template v-if="to">
      <router-link :to="to">
        <slot />
      </router-link>
    </template>
    <template v-else>
      <span>
        <slot />
      </span>
    </template>
    <i>{{seperator}}</i>
  </div>
</template>

<script>
import { inject } from 'vue'
export default {
  name: 'XtxBreadItem',
  props: {
    to: {
      type: String
    }
  },
  setup () {
    const seperator = inject('seperator')
    return {
      seperator
    }
  }
}
</script>
<style lang="less" scoped>
  .xtx-bread-item{
    i{
      padding: 0 5px;
    }
    // 最后一个i隐藏
    &:nth-last-of-type(1){
      i{
        display: none;
      }
    }
    a {
      color: #666;
      transition: all .4s;
      &:hover {
        color: @xtxColor;
      }
    }
  }

</style>
